import { getTreeChannelApi } from "@/api/configCenter/warehouseEntryChannel";
import { reactive } from "vue";

export const searchItemList: Array<SuperSearch.SearchItem> = [
  {
    type: "input",
    label: "运单号",
    keyName: "waybillNums",
    placeholder: "支持批量(空格/逗号隔开)"
  },
  reactive<SuperSearch.SearchItem>({
    type: "cascader",
    label: "预报渠道",
    keyName: "channelId",
    optionsRequest: getTreeChannelApi,
    optReqParams: {},
    optReqCb: (res: Base.GeneraDataType, row: SuperSearch.SearchItem) => {
      const { code, data } = res;
      if (code === 200) {
        console.log(res);
        row.options = data || [];
      }
    },
    optConfig: {
      label: "label",
      value: "value",
      children: "children"
    },
    options: []
  }),
  {
    type: "input",
    label: "费用名称",
    keyName: "costName"
  }
];
export const tableColumn: Array<SuperTable.TableCoulmnItem | SuperTable.NestTableColumnItem> = [
  {
    type: "checkbox",
    field: "checkbox",
    minWidth: "50",
    fixed: "left"
  },
  {
    field: "waybillNum",
    title: "运单号",
    minWidth: "150",
    fixed: "left"
  },
  {
    field: "channelName",
    title: "预报渠道",
    minWidth: "100"
  },
  {
    field: "approvalUserName",
    title: "审核人",
    minWidth: "90"
  },
  {
    field: "approvalTime",
    title: "审核时间",
    minWidth: "135",
    formatter: "formatDate"
  },
  {
    field: "costName",
    title: "费用名称",
    minWidth: "90"
  },
  {
    field: "clearingUnitPrice",
    title: "单价",
    minWidth: "80"
  },
  {
    field: "unit",
    title: "单位",
    minWidth: "80"
  },
  {
    field: "number",
    title: "数量",
    minWidth: "80"
  },
  {
    field: "depositTime",
    title: "拣货时间",
    minWidth: "135",
    formatter: "formatDate",
    fixed: "right"
  }
];
